﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" CodeBehind="zzzListDetails.aspx.cs" Inherits="BaseSRS_CPRequests_zz.ListDetails" %>

<%@ Register src="~/DynamicData/Content/GridViewPager.ascx" tagname="GridViewPager" tagprefix="asp" %>

<asp:Content ID="headContent" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true">
        <DataControls>
            <asp:DataControlReference ControlID="FormView1" />
            <asp:DataControlReference ControlID="GridView1" />
        </DataControls>
    </asp:DynamicDataManager>

    <h2 class="DDSubHeader">Request Table Maintenance</h2>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="DDRequests">

                <asp:DynamicValidator runat="server" ID="GridViewValidator" ControlToValidate="GridView1" Display="None" CssClass="DDValidator" />
                <asp:DynamicValidator runat="server" ID="FormViewValidator" ControlToValidate="FormView1" Display="None" CssClass="DDValidator" />

                <asp:QueryableFilterRepeater runat="server" ID="FilterRepeater">
                    <ItemTemplate>
                        <table width="320px" border="0">
                            <tr>
                                <td width="78px" height="10px" align="right">
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("DisplayName") %>' OnPreRender="Label_PreRender" Visible="true" CssClass="SRSFilterLabel" SkinID="SRSFilterLabel" />
                                </td>
                                <td>
                                    <asp:DynamicFilter runat="server" ID="DynamicFilter" OnFilterChanged="DynamicFilter_FilterChanged" Visible="True" />
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:QueryableFilterRepeater>
            </div>
            
            <asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource"
                AllowPaging="True" AllowSorting="True" OnDataBound="GridView1_DataBound"
                OnRowEditing="GridView1_RowEditing" OnRowDeleted="GridView1_RowDeleted"
                OnRowUpdated="GridView1_RowUpdated"
                OnRowCreated="GridView1_RowCreated" CssClass="DDGridView"
                RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6"
                EnableSortingAndPagingCallbacks="True"
                RowStyle-HorizontalAlign="NotSet" AutoGenerateColumns="False"
                HeaderStyle-HorizontalAlign="NotSet" DataKeyNames="Request_ID"
                AutoGenerateSelectButton="false" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true" EnablePersistedSelection="True">

                <Columns>
                    <asp:BoundField DataField="Request_ID" HeaderText="Request_ID" ReadOnly="True" SortExpression="Request_ID" />
                    <asp:BoundField DataField="Assignee_ID" HeaderText="Assignee_ID" SortExpression="Assignee_ID" />
                    <asp:BoundField DataField="RequestType_ID" HeaderText="RequestType_ID" SortExpression="RequestType_ID" />
                    <asp:BoundField DataField="Priority_ID" HeaderText="Priority_ID" SortExpression="Priority_ID" />
                    <asp:BoundField DataField="WorkStatus_ID" HeaderText="WorkStatus_ID" SortExpression="WorkStatus_ID" />
                    <asp:BoundField DataField="Disposition_ID" HeaderText="Disposition_ID" SortExpression="Disposition_ID"></asp:BoundField>
                </Columns>
                <HeaderStyle CssClass="th" />
                <PagerStyle CssClass="DDFooter" />
                <PagerTemplate>
                    <asp:GridViewPager ID="GridViewPager1" runat="server" />
                </PagerTemplate>
                <EmptyDataTemplate>
                    There are currently no items in this table.
                </EmptyDataTemplate>
                <RowStyle CssClass="td" />
            </asp:GridView>

            <asp:QueryExtender ID="GridQueryExtender" TargetControlID="GridDataSource" runat="server">
                <asp:DynamicFilterExpression ControlID="FilterRepeater" />
            </asp:QueryExtender>

            <asp:Panel ID="DetailsPanel" runat="server" Visible="false" CssClass="SRSDetailsPanel" SkinID="SRSDetailsPanel">
                <asp:FormView ID="FormView1" runat="server" DataSourceID="DetailsDataSource" RenderOuterTable="false"
                    OnPreRender="FormView1_PreRender" OnModeChanging="FormView1_ModeChanging" OnItemUpdated="FormView1_ItemUpdated"
                    OnItemInserted="FormView1_ItemInserted" OnItemDeleted="FormView1_ItemDeleted">
                    <EditItemTemplate>
                        Request_ID:
                        <asp:TextBox Text='<%# Bind("Request_ID") %>' runat="server" ID="Request_IDTextBox" /><br />
                        Submitted:
                        <asp:TextBox Text='<%# Bind("Submitted") %>' runat="server" ID="SubmittedTextBox" /><br />
                        Description:
                        <asp:TextBox Text='<%# Bind("Description") %>' runat="server" ID="DescriptionTextBox" /><br />
                        RequestType_ID:
                        <asp:TextBox Text='<%# Bind("RequestType_ID") %>' runat="server" ID="RequestType_IDTextBox" /><br />
                        Priority_ID:
                        <asp:TextBox Text='<%# Bind("Priority_ID") %>' runat="server" ID="Priority_IDTextBox" /><br />
                        Disposition_ID:
                        <asp:TextBox Text='<%# Bind("Disposition_ID") %>' runat="server" ID="Disposition_IDTextBox" /><br />
                        <asp:LinkButton runat="server" Text="Update" CommandName="Update" ID="UpdateButton" CausesValidation="True" />&nbsp;<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="UpdateCancelButton" CausesValidation="False" />
                    </EditItemTemplate>
                    <HeaderTemplate>
                        <table id="detailsTable" class="DDDetailsTable" cellpadding="6">
                    </HeaderTemplate>
                    <InsertItemTemplate>
                        Request_ID:
                        <asp:TextBox Text='<%# Bind("Request_ID") %>' runat="server" ID="Request_IDTextBox" /><br />
                        Submitted:
                        <asp:TextBox Text='<%# Bind("Submitted") %>' runat="server" ID="SubmittedTextBox" /><br />
                        Description:
                        <asp:TextBox Text='<%# Bind("Description") %>' runat="server" ID="DescriptionTextBox" /><br />
                        RequestType_ID:
                        <asp:TextBox Text='<%# Bind("RequestType_ID") %>' runat="server" ID="RequestType_IDTextBox" /><br />
                        Priority_ID:
                        <asp:TextBox Text='<%# Bind("Priority_ID") %>' runat="server" ID="Priority_IDTextBox" /><br />
                        Disposition_ID:
                        <asp:TextBox Text='<%# Bind("Disposition_ID") %>' runat="server" ID="Disposition_IDTextBox" /><br />
                        <asp:LinkButton runat="server" Text="Insert" CommandName="Insert" ID="InsertButton" CausesValidation="True" />&nbsp;<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="InsertCancelButton" CausesValidation="False" />
                    </InsertItemTemplate>
                    <ItemTemplate>
                        Request_ID:
                        <asp:Label Text='<%# Bind("Request_ID") %>' runat="server" ID="Request_IDLabel" /><br />
                        Submitted:
                        <asp:Label Text='<%# Bind("Submitted") %>' runat="server" ID="SubmittedLabel" /><br />
                        Description:
                        <asp:Label Text='<%# Bind("Description") %>' runat="server" ID="DescriptionLabel" /><br />
                        RequestType_ID:
                        <asp:Label Text='<%# Bind("RequestType_ID") %>' runat="server" ID="RequestType_IDLabel" /><br />
                        Priority_ID:
                        <asp:Label Text='<%# Bind("Priority_ID") %>' runat="server" ID="Priority_IDLabel" /><br />
                        Disposition_ID:
                        <asp:Label Text='<%# Bind("Disposition_ID") %>' runat="server" ID="Disposition_IDLabel" /><br />


                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DynamicEntity ID="DynamicEntity2" runat="server" Mode="Edit" />
                        <tr class="td">
                            <td colspan="2">
                                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Update" Text="Update" />
                                <asp:LinkButton ID="LinkButton5" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
                            </td>
                        </tr>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DynamicEntity ID="DynamicEntity3" runat="server" Mode="Insert" />
                        <tr class="td">
                            <td colspan="2">
                                <asp:LinkButton ID="LinkButton6" runat="server" CommandName="Insert" Text="Insert" />
                                <asp:LinkButton ID="LinkButton7" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
                            </td>
                        </tr>
                    </InsertItemTemplate>
                    <FooterTemplate>
                        </table>
                    </FooterTemplate>
                </asp:FormView>

                <asp:EntityDataSource ID="DetailsDataSource" runat="server" ConnectionString="name=srsremoteEntities" DefaultContainerName="srsremoteEntities" EnableFlattening="True" EntitySetName="Requests" EntityTypeFilter="Request" Select="it.[Request_ID], it.[Submitted], it.[Description], it.[RequestType_ID], it.[Priority_ID], it.[Disposition_ID]" AutoGenerateOrderByClause="True" EnableUpdate="True" />
                <asp:EntityDataSource ID="GridDataSource" runat="server" ConnectionString="name=srsremoteEntities" DefaultContainerName="srsremoteEntities" EntitySetName="Requests" OrderBy="" EnableFlattening="False" EntityTypeFilter="Request" AutoGenerateOrderByClause="True" EnableDelete="True" EnableInsert="True" EnableUpdate="True" />

                <asp:QueryExtender ID="QueryExtender1" TargetControlID="DetailsDataSource" runat="server">
                    <asp:ControlFilterExpression ControlID="GridView1" />
                </asp:QueryExtender>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>